using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Publicuse.Entity;
using Publicuse.Util;

namespace Publicuse.Export
{
    /// <summary>
    /// 数据表代码生成模板信息管理信息导出辅助类
    /// </summary>
    public class TbcodegenerationExport
  {
    /// <summary>
    /// 数据表代码生成模板信息管理导出数据设置
    /// </summary>
    /// <param name="excelName"></param>
    /// <param name="fileName"></param>
    /// <param name="list"></param>
    /// <param name="msg"></param>
    /// <returns></returns>
    public static MemoryStream ExportData(string fileName, string excelName, List<Tbcodegeneration> list, out string msg)
    {
      msg = string.Empty;
      MemoryStream ms = ExcelUtil.GetExcelUtil.InitExportData(fileName, excelName, list, (row, cell, sheet1, TextSytle, srow, hssfworkbook) => {

        foreach (Tbcodegeneration item in list)
        {
          srow++;
          row = sheet1.CreateRow(srow);
          //表名称
		cell = row.CreateCell(0);
			cell.CellStyle = TextSytle;
			cell.SetCellValue(item.name);
//表编码
		cell = row.CreateCell(1);
			cell.CellStyle = TextSytle;
			cell.SetCellValue(item.code);
//模板内容
		cell = row.CreateCell(2);
			cell.CellStyle = TextSytle;
			cell.SetCellValue(item.content);

        }
      }, out msg, 2,true);
      return ms;
    }
  }
}